package com.example.bourse.service.impl;

import com.example.bourse.mapper.MenuMapper;
import com.example.bourse.pojo.entity.Menu;
import com.example.bourse.service.MenuService;
import org.noear.solon.annotation.Inject;
import org.noear.solon.annotation.Component;
import java.util.List;

@Component
public class MenuServiceImpl implements MenuService {

    @Inject
    private MenuMapper menuMapper;

    @Override
    public List<Menu> getAllMenus() {
        return menuMapper.selectAll();
    }

    @Override
    public void addMenu(Menu menu) {
        menuMapper.insert(menu);
    }

    @Override
    public void updateMenu(Menu menu) {
        menuMapper.updateById(menu);
    }

    @Override
    public void deleteMenu(long menuId) {
        menuMapper.deleteById(menuId);
    }

    @Override
    public List<Menu> getUserMenus(long userId) {
        return menuMapper.selectByUserId(userId);
    }
}
